<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<style>
<!--
	
	#userNamee{
    width: 220px;
    height: 70px;
    line-height: 30px;
    padding: 10px 10px 10px 53px;
    border: 1px solid #FFF;
    border-radius: 3px;
    color: #858585;
    font-size: 12px;
    background: url('../image/bg.jpg') no-repeat scroll 10px 0px #FFF;
	}
	
-->
</style>

<html>
  <head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title></title>
	<link href="${pageContext.request.contextPath}/Waiter/css/index.css" rel="stylesheet" type="text/css" />
	 <link rel="stylesheet" href="${pageContext.request.contextPath}/Waiter/css/pintuer.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/Waiter/css/admin.css">
	 <link href="${pageContext.request.contextPath}/sys/style/css/toastr.css" rel="stylesheet" />
	
	<script type="text/javascript" src="${pageContext.request.contextPath}/Waiter/js/jquery.1.4.2-min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/Waiter/js/waiter.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/Waiter/js/cart.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/sys/style/js/toastr.min.js"></script> 
	<script src="${pageContext.request.contextPath}/Waiter/js/waiter.js"></script>

</head>
<body>

<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 订单列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
  <div class="gwc" style=" margin:auto;">
	<table id="mytable" cellpadding="0" cellspacing="0" class="gwc_tb1">
		<tr>
			<h3 style="display:block" >请选择桌号</h3> 
			<div>
				<form action="/OrderSystem/SelectAction" mehtod="post" onsubmit="return search_order_ByTid()" >
					<select name="sele_n_name" id="sele_n_id"  name="type" style="width:150px; line-height:10px;font-size:10px;float:left;" class="input">				 		 
		  			</select>	  			
		  			<input class="button border-main icon-search"  type="submit" name="button" id="button" value="搜索">			  					  			
	  			</form>
	  		</div>
  		</tr>		
  			<span >
  				当前桌号为：
  				<input name="canzhuo_id" id="userNamee" readonly="true" style="width:240px;"  type="text" value="<s:property value="select_tid"/>" />
  			</span>
  			
			<td class="tb1_td3">菜名</td>
			<td class="tb1_td4">描述</td>
			<td class="tb1_td5">数量</td>
			<td class="tb1_td6">单价</td>
			<td class="tb1_td7">总价</td>
			<td class="tb1_td8">操作</td>
		</tr>
	</table>
		   
	<!---商品加减算总数---->

	
	<table id="mytable" cellpadding="0" cellspacing="0" class="gwc_tb2">
	<!-- 加一个if判断是否为空 -->
        <s:iterator value="list_selectCart" var="Menu">
        <input class="m_id_c" id="m_id" type="hidden" value="<s:property value="#Menu.m_id"/>" />
        
       <%--  <tr onmousemove="number_count(<s:property value="#Menu.jsp_add"/> , <s:property value="#Menu.jsp_min"/> , <s:property value="#Menu.jsp_number"/> , <s:property value="#Menu.jsp_zonjia"/> , <s:property value="#Menu.jsp_danjia"/>)" > --%>
	     	<tr>
	             	<td>&nbsp;&nbsp;</td>
	           		<td>&nbsp;&nbsp;</td>
	           		<td>&nbsp;&nbsp;</td>
	           		<td>&nbsp;&nbsp;</td>
	           		<td>&nbsp;&nbsp;</td>
	           		<td>&nbsp;&nbsp;</td>
	           		<td>&nbsp;&nbsp;</td>
	      	</tr>
        
       <!-- 此di用于获取单价和总价 -->
		<tr class="count_number">
			<td class="tb2_td1"></td>
			
			
			<!-- 显示图片 -->
			<td class="tb2_td2">
			    <s:if test="#Menu.m_url_defal!=''">
              			<img src="/OrderSystem/img/<s:property value="#Menu.m_url_defal"/>" height="80px" width="100px" id="imgg"/>
              	</s:if>
              	<s:else>
              			<img src="/OrderSystem/img/UnUpLoadImg.png" height="80px" width="100px" id="imgg"/>
              	</s:else>
            </td>
			<!-- 显示图片 -->
			
			<td class="tb2_td3"><s:property value="#Menu.m_name"/></td>
			<td class="tb1_td4"><s:property value="#Menu.m_describe"/></td>
			
			<!-- 数量框 -->
			<td class="tb1_td5">
				<button class="id_add" >+</button>
				<input class="id_number" id="<s:property value="#Menu.jsp_number"/>" name="number_box" type="text" value="<s:property value="#Menu.o_number"/>" style=" width:30px; text-align:center; border:1px solid #ccc;" />
				<button class="id_min" >-</button>
			</td>
			<!-- 数量框 -->
			
			<!-- 显示单价 -->
			<td class="tb1_td6">
				<label id="<s:property value="#Menu.jsp_danjia"/>"  class="tot_danjia" style="color:#ff5500;font-size:14px; font-weight:bold;"><s:property value="#Menu.m_price"/> </label>
			</td>
			
			<!-- 显示总价 -->
			<td class="tb1_td7">
				<label id="<s:property value="#Menu.jsp_zonjia"/>"  class="tot_zonjia" style="color:#ff5500;font-size:14px; font-weight:bold;"><s:property value="#Menu.m_price"/> </label>
			</td>
			<!-- 显示总价 -->
			
			<td class="tb1_td8">
				<a href="/OrderSystem/deleteCarts.action?mid=<s:property value="#Menu.m_id"/>&tid=<s:property value="#Menu.t_id"/>">删除</a>
			</td>
		</tr>	   
		</s:iterator>
</table>
	<table id="mytable2" cellpadding="0" cellspacing="0" class="gwc_tb3">
		<tr>
			<td class="tb1_td1"></td>
			<td class="tb1_td1"></td>
			<td class="tb3_td1"></td>
			<td class="tb3_td2">菜品 <label id="shuliang" style="color:#ff5500;font-size:14px; font-weight:bold;">0</label> 件</td>
			<td class="tb3_td3">合计:<span>￥</span><span style=" color:#ff5500;"><label id="zong1" style="color:#ff5500;font-size:14px; font-weight:bold;"></label></span></td>
			<td class="tb3_td4"><span id="jz1">结算</span><a href="#" style=" display:none;"  class="jz2" id="jz2" onclick="settle_accounts()">结算</a></td>
		</tr>
	</table>

    </div>
  </div>
</body>
<script type="text/javascript">	
	$(function () 
	{	
		/*显示计算按钮的样式*/
		$("#jz1").css("display", "none");
		$("#jz2").css("display", "block");
		/*显示计算按钮的样式*/
		
		JiSuan();
		
		/*单击增加按钮，增加数量*/
		$(".id_add").click(function ()
		{
			//数量
			var t =$(this).parent().find(".id_number");
			t.val(parseInt(t.val())+1);
			
			/*找到此td的祖先，再向下找他的tr*/
			/*获取到单价的价格*/
			var danjia = $(this).parents(".count_number").find(".tb1_td6").find(".tot_danjia");
			/*获取到总价的价格*/
			var zonjia = $(this).parents(".count_number").find(".tb1_td7").find(".tot_zonjia");
			//总价=单价*数量
			zonjia.text(t.val()*parseInt(danjia.text()));
			
			JiSuan();
		})
		
		/*单击减少按钮，增加数量*/
		$(".id_min").click(function ()
		{
			var t =$(this).parent().find(".id_number");
			if((parseInt(t.val())-1)<0)
			{
				t.val(0);
				toastr.warning('数量不可小于0');
				return;			
			}
			else
			{
				t.val(parseInt(t.val())-1);
			}
			
			/*找到此td的祖先，再向下找他的tr*/
			/*获取到单价的价格*/
			var danjia = $(this).parents(".count_number").find(".tb1_td6").find(".tot_danjia");
			/*获取到总价的价格*/
			var zonjia = $(this).parents(".count_number").find(".tb1_td7").find(".tot_zonjia");
			//总价=单价*数量
			zonjia.text(t.val()*parseInt(danjia.text()));
			
			JiSuan();
			
		})
	});
	
	</script>	
</html>
